package com.neuedu.springmvc.entity;



import com.neuedu.springmvc.ValidateV1;
import com.neuedu.springmvc.ValidateV2;

import javax.validation.constraints.Min;
import javax.validation.constraints.Size;
import java.util.Date;

/**
 * 项目：springmvc-java4
 * 创建时间：  2022-03-23   11:38
 * 作者 :jshand
 * 描述 :
 */
public class User {

    private Integer id;

    // /v2
    @Size(min = 5, message = "{user.name.length}",groups ={ValidateV2.class} )
    private String name;
    @Size(min = 5, message = "{user.address.length}",groups ={ValidateV2.class})
    private String address;


    //   /v1  在登录的时候用的条件
    @Size(min = 5,max = 50 , message = "用户名长度不能少于5个,不能大于50个",groups ={ValidateV1.class})
    private String username;
    @Size(min = 8,max = 50 , message = "密码长度不能少于8个,不能大于50个",groups ={ValidateV1.class})
    private String password;

    private Date time;

    public Date getTime() {
        return time;
    }

    public void setTime(Date time) {
        this.time = time;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", address='" + address + '\'' +
                ", username='" + username + '\'' +
                ", password='" + password + '\'' +
                ", time=" + time +
                '}';
    }
}
